// components/category-card/category-card.js
import {
    queryTertiaryCategories
}
    from "../../service/category"

Component({

    /**
     * 组件的属性列表
     */
    properties: {
        // 二级分类标题
        name: {
            type: String,
            value: '儿牙矫正'
        },
        // 二级分类id
        categoryId: {
            type: Number,
            value: 2201
        }
    },

    /**
     * 组件的初始数据
     */
    data: {
        tertiaryCategoryList: []
    },

    /**
     * 组件的方法列表
     */
    methods: {
      /**
       *  点击三级分类标签
       */
      onTapTertiaryCategoryLabel(event){
        console.log(event.target.dataset);
      }
    },
    lifetimes: {
        async attached() {
            const {
                data
            } = await queryTertiaryCategories(this.data.categoryId)
            this.setData({
                tertiaryCategoryList: data
            })
        }
    }
})